public class xueshu_ {
    public static void main(String[] args) {
        int num1=20;
        int num2=40;
        while(num1!=0){
            int temp=num2%num1;
            num2=num1;
            num1=temp;
        }
        System.out.println(num2);
    }
}
